package com.abc.invoke.server.service;

import java.util.Map;

import com.abc.invoke.server.service.impl.SystemInfoSubNexus;
import com.abc.invoke.server.service.impl.UserPermissionSubNexus;
import com.abc.invoke.server.service.impl.UserSubNexus;
import com.abc.invoke.services.interfaces.SystemInfoInterface;
import com.abc.invoke.services.interfaces.UserInterface;
import com.abc.invoke.services.interfaces.UserPermissionInterface;
import com.google.common.collect.ImmutableClassToInstanceMap;

public class NexusWithSubNexuses {

	private final ImmutableClassToInstanceMap<Object> subNexus;
	private final Nexus nexus;
	public NexusWithSubNexuses(Nexus nexus){
		this.nexus=nexus;
		ImmutableClassToInstanceMap.Builder<Object> builder=ImmutableClassToInstanceMap.builder();
		
		InterNexusInterface interNexus=new InterNexusInterfaceImpl(nexus);
		builder.put(UserInterface.class, new UserSubNexus(interNexus));
		builder.put(SystemInfoInterface.class, new SystemInfoSubNexus(interNexus));
		builder.put(UserPermissionInterface.class, new UserPermissionSubNexus(interNexus));
		subNexus=builder.build();
	}
	
	public Map<Class<?>, Object> getSunNexuses(){
		return subNexus;
	}
}
